package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.QuotationPriceEntity;
import com.lx.oms.controller.manager.QuotationPriceManager;
import com.lx.oms.controller.service.QuotationPriceService;

/**
 * 行情价格
 *
 * @author houzhong
 * @date 2018年7月12日 下午2:41:51
 */
@Service("quotationPriceService")
public class QuotationPriceServiceImpl implements QuotationPriceService {

	@Autowired
	private QuotationPriceManager quotationPriceManager;

	@Override
	public Page<QuotationPriceEntity> listQuotationPrice(Map<String, Object> params) {
		Query query = new Query(params);
		Page<QuotationPriceEntity> page = new Page<>(query);
		quotationPriceManager.listQuotationPrice(page, query);
		return page;
	}

	@Override
	public R saveQuotationPrice(QuotationPriceEntity role) {
		int count = quotationPriceManager.saveQuotationPrice(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getQuotationPriceById(BigInteger id) {
		QuotationPriceEntity tQuotationPrice = quotationPriceManager.getQuotationPriceById(id);
		return CommonUtils.msg(tQuotationPrice);
	}

	@Override
	public R updateQuotationPrice(QuotationPriceEntity quotationPrice) {
		int count = quotationPriceManager.updateQuotationPrice(quotationPrice);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = quotationPriceManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
